package com.sise.bl.service.impl;

import com.sise.bl.dao.TypeDao;
import com.sise.bl.entity.Type;
import com.sise.bl.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service("typeService")
public class TypeServiceImpl implements TypeService {
    @Autowired
    @Qualifier("typeDao")
    private TypeDao typeDao;

    @Override
    public List<Type> findAll() {
        List<Type> types = typeDao.selectAll();
        return types;
    }

    @Override
    public int addType(Type type) {
        int insert = typeDao.insert(type);
        return insert;
    }

    @Override
    public Type queryTypeByid(Integer tid) {
        Type type = typeDao.selectTypeByid(tid);
        return type;
    }

    @Override
    public void modifyType(Type type) {
        typeDao.updateType(type);
    }
}
